let content = $("#content");
let breadcrumb = $("#breadcrumb");
let main = function() {
	let u = "manage" + document.location.hash.substr(1);
	
	$.ajax({
		url: u + ".html?v=" + new Date().getTime(),
		dataType: "html",
		type: "get",
		success: function(html) {
			content.html(html);
			require([u], function(m) {
				var title = m.title;
				breadcrumb.empty();
				$.each(title, function(i, item) {
					$("<li></li>").html(item).appendTo(breadcrumb);
				});
				window.document.title=title[title.length-1];
				breadcrumb.children().last().addClass("active");
				m.init(content);
			});
		},
		error: function() {
			content.html(`<div class="panel panel-default">
		<div class="panel-body text-center">
			<div>
				<i class="glyphicon glyphicon-remove-sign" style="font-size: 60px; line-height: 100px; color: red;"></i> <span style="font-size: 24px; position: relative; top: -20px; margin-left: 10px;">开发该功能的程序员正在赶工，请耐心等待！</span>
			</div>
			<br>
			<a href="./user.html" class="btn btn-default">返回用户中心</a>
		</div>
	</div>`);
			breadcrumb.empty();
			$("<li>错误中心</li>").appendTo(breadcrumb);
			breadcrumb.children().last().addClass("active");
		}
	});
}
window.onhashchange = main;
window.onload = main;